package com.gc.cscott.domain.result;

import com.gc.cscott.domain.contest.TestCase;
import com.gc.cscott.domain.contest.numbers.TaskNumber;
import com.gc.cscott.domain.contest.numbers.TestCaseNumber;

/**
 *
 * @author root
 */
public class TestCaseResult {
    int taskNumber;
    int testCaseNumber;
    HowEnded result = HowEnded.NotTested;
    String hint;
    String outputDumpName;
    long payedTime;

    public String getHint() {
        return hint;
    }

    public void setHint(String hint) {
        this.hint = hint;
    }

    public String getOutputDumpName() {
        return outputDumpName;
    }

    public void setOutputDumpName(String outputDumpName) {
        this.outputDumpName = outputDumpName;
    }

    public long getPayedTime() {
        return payedTime;
    }

    public void setPayedTime(long payedTime) {
        this.payedTime = payedTime;
    }

    public HowEnded getResult() {
        return result;
    }

    public void setResult(HowEnded result) {
        this.result = result;
    }

    public TaskNumber getTaskNumber() {
        return new TaskNumber(taskNumber);
    }


    public TestCaseNumber getTestCaseNumber() {
        return new TestCaseNumber(testCaseNumber);
    }

    public void setTestCase(TestCase testCase) {
        this.taskNumber = testCase.getTask().getNumber().intValue();
        this.testCaseNumber = testCase.getNumber().intValue();
    }

    public static enum HowEnded {
        NotVerified("NV"),
        NotTested("NT"),
        ExecutableNotFound("NE"),
        CanNotExecute("EF"),
        Timeout("TO"),
        NoOutputFile("NO"),
        Wrong("WR"),
        Correct("OK");
        String code;

        private HowEnded(String code) {
            this.code = code;
        }

        public String getCode() {
            return code;
        }

    }
}
